clear all
clc
close all

load AALabData
Row=row;
Column=column;

load AANewData
Row=[Row;row'];
Column=[Column;column'];

load AAMTData
Row=[Row;row];
Column=[Column;column];

ROW=zeros(486,9);
for i=1:486
    ROW(i,:)=reshape(Row{i},[9,1])';
end
[~,I]=unique(ROW,'rows');

Row=Row(I,:);
Column=Column(I,:);

n=length(Row);


Dominant=zeros(n,3);
for i=1:n
    if sum(Row{i}(1,:)-Row{i}(2,:)>0)==3 && sum(Row{i}(1,:)-Row{i}(3,:)>0)==3
        Dominant(i,1)=1;
    end
    if sum(Row{i}(2,:)-Row{i}(1,:)>0)==3 && sum(Row{i}(2,:)-Row{i}(3,:)>0)==3
        Dominant(i,2)=1;
    end
    if sum(Row{i}(3,:)-Row{i}(1,:)>0)==3 && sum(Row{i}(3,:)-Row{i}(2,:)>0)==3
        Dominant(i,3)=1;
    end
end

Dominated=zeros(n,3);
for i=1:n
    if sum(Row{i}(1,:)-Row{i}(2,:)<0)==3 || sum(Row{i}(1,:)-Row{i}(3,:)<0)==3
        Dominated(i,1)=1;
    end
    if sum(Row{i}(2,:)-Row{i}(1,:)<0)==3 || sum(Row{i}(2,:)-Row{i}(3,:)<0)==3
        Dominated(i,2)=1;
    end
    if sum(Row{i}(3,:)-Row{i}(1,:)<0)==3 || sum(Row{i}(3,:)-Row{i}(2,:)<0)==3
        Dominated(i,3)=1;
    end
end

save FM Dominant Dominated
    
        